/**********************************************************************/
/*                                                                    */
/* File name: define.h                                                */
/*                                                                    */
/* Since:     2004-Sept-20                                            */
/*                                                                    */
/* Version:   PICos18 v2.10                                           */
/*            Copyright (C) 2003, 2004, 2005 Pragmatec.               */
/*                                                                    */
/* Author:    Designed by Pragmatec S.A.R.L.        www.pragmatec.net */
/*            MONTAGNE Xavier [XM]      xavier.montagne@pragmatec.net */
/*            NIELSEN  Peter  [PN]                   pnielsen@tuug.fi */
/*                                                                    */
/* Purpose:   Specify all the specific definitions of the project.    */
/*                                                                    */
/* Distribution: This file is part of PICos18.                        */
/*            PICos18 is free software; you can redistribute it       */
/*            and/or modify it under the terms of the GNU General     */
/*            Public License as published by the Free Software        */
/*            Foundation; either version 2, or (at your option)       */
/*            any later version.                                      */
/*                                                                    */
/*            PICos18 is distributed in the hope that it will be      */
/*            useful, but WITHOUT ANY WARRANTY; without even the      */
/*            implied warranty of MERCHANTABILITY or FITNESS FOR A    */
/*            PARTICULAR PURPOSE.  See the GNU General Public         */
/*            License for more details.                               */
/*                                                                    */
/*            You should have received a copy of the GNU General      */
/*            Public License along with gpsim; see the file           */
/*            COPYING.txt. If not, write to the Free Software         */
/*            Foundation, 59 Temple Place - Suite 330,                */
/*            Boston, MA 02111-1307, USA.                             */
/*                                                                    */
/*          > A special exception to the GPL can be applied should    */
/*            you wish to distribute a combined work that includes    */
/*            PICos18, without being obliged to provide the source    */
/*            code for any proprietary components.                    */
/*                                                                    */
/* History:                                                           */
/* 2004/11/06 [RZR] Original idea of RZR.                             */
/* 2007/01/01 [PN]  Added magic formula dedicated to clock frequency. */
/*                                                                    */
/**********************************************************************/

#ifndef _DEFINE_H
#define _DEFINE_H

#include "device.h"


/************DIRECTION MOTEUR*************/
#define STOP 1
#define AVANCE 2
#define RECULE 3
#define DROITE 4
#define GAUCHE 5
#define GAUCHE_LENT 6
#define DROITE_LENT 7
#define TPLACEDROITE 8
#define TPLACEGAUCHE 9


/***********************************************************************
 * ------------------------ Timer settings -----------------------------
 **********************************************************************/
// TMR = 65536 - (CPU_FREQUENCY_HZ/4/2/50)
#define TMR1_20MS	40536
#define TMR3_20MS	40536


/* LMAGIC : Tmr0.lt = 65536 - (CPU_FREQUENCY_HZ/4/1000 - 23)  */
//#define _10MHZ	63320
//#define _16MHZ	61768
//#define _20MHZ	60768
//#define _32MHZ	57768
//#define _40MHZ 	55768

#define _4MHZ	64559
#define _10MHZ	63111
#define _16MHZ	61559
#define _20MHZ	60559
#define _32MHZ	57559
#define _40MHZ 	55559

/***********************************************************************
 * ----------------------------- Alarms --------------------------------
 **********************************************************************/

//Definit l'INDICE de l'alarme dans Alarm_List (taskdesc) !!!!!!!
#define ALARM_TSK_INFRA      0
#define ALARM_TSK_LED        2
#define ALARM_TSK_MOTEUR     1

/***********************************************************************
 * ----------------------------- Events --------------------------------
 **********************************************************************/

#define EVENT_INFRA       0x08
#define EVENT_RS232DRV    0x02
#define EVENT_LED    	  0x04
#define EVENT_MOTEUR   	  0x01

#define RS_NEW_MSG        0x10
#define RS_RCV_MSG        0x20
#define RS_QUEUE_EMPTY    0x40
#define RS_QUEUE_FULL     0x80

/***********************************************************************
 * ----------------------------- Task ID -------------------------------
 **********************************************************************/

#define ID_TASK_INFRA        0
#define ID_TASK_RS232DRV     1
#define ID_TASK_LED     	 2
#define ID_TASK_MOTEUR     	 3

/***********************************************************************
 * ----------------------------- Task Prio -------------------------------
 **********************************************************************/
#define PRIO_TASK_INFRA       15
#define PRIO_TASK_RS232DRV    10
#define PRIO_TASK_LED		  14
#define PRIO_TASK_MOTEUR	  9

#endif /* _DEFINE_H */


/* End of File : define.h */
